const translations = {
    zh: {
        title: "DeepSeek AI \u4f7f\u7528\u8bf4\u660e",
        subtitle: "\u8ba9 AI \u52a9\u624b\u4e3a\u60a8\u7684\u7f51\u9875\u6d4f\u89c8\u4f53\u9a8c\u589e\u6dfb\u667a\u6167",
        quickStart: "\u5feb\u901f\u5f00\u59cb",
        chromeInstall: "Chrome \u5546\u5e97\u5b89\u88c5",
        chromeDesc: "\u4ece Chrome \u7f51\u4e0a\u5e94\u7528\u5e97\u5b89\u88c5\u6269\u5c55",
        edgeInstall: "Edge \u5546\u5e97\u5b89\u88c5",
        edgeDesc: "\u4ece Edge \u7f51\u4e0a\u5e94\u7528\u5e97\u5b89\u88c5\u6269\u5c55",
        deepseekWebsite: "DeepSeek \u5b98\u7f51",
        deepseekDesc: "\u8bbf\u95ee DeepSeek AI \u5b98\u65b9\u7f51\u7ad9",
        apiKey: "\u83b7\u53d6 API Key",
        apiDesc: "\u5728 DeepSeek \u5e73\u53f0\u83b7\u53d6\u60a8\u7684 API \u5bc6\u94a5",
        shortcuts: "\u5feb\u6377\u952e\u8bbe\u7f6e",
        shortcutsDesc: "\u81ea\u5b9a\u4e49\u6269\u5c55\u5feb\u6377\u952e",
        github: "GitHub \u4ed3\u5e93",
        githubDesc: "\u67e5\u770b\u6e90\u4ee3\u7801\u548c\u63d0\u4ea4\u5efa\u8bae",
        installationSteps: ["\u5728\u6d4f\u89c8\u5668\u4e2d\u5b89\u88c5 DeepSeek AI \u6269\u5c55", "\u70b9\u51fb\u5de5\u5177\u680f\u4e2d\u7684\u6269\u5c55\u56fe\u6807", "\u8f93\u5165\u60a8\u7684 DeepSeek API \u5bc6\u94a5", "\u9009\u62e9\u60a8\u504f\u597d\u7684\u56de\u7b54\u8bed\u8a00", "\u5f00\u542f\u5feb\u6377\u6309\u94ae\u529f\u80fd", "\u8bbe\u7f6e\u4f60\u504f\u597d\u7684\u5feb\u6377\u952e", "\u5728\u4efb\u610f\u7f51\u9875\u4e0a\u9009\u62e9\u6587\u672c\uff0c\u5f00\u59cb\u4e0e AI \u5bf9\u8bdd\uff01"],
        usage: "\u4f7f\u7528\u65b9\u6cd5",
        quickButton: "\u5feb\u6377\u6309\u94ae\u4f7f\u7528",
        quickButtonDesc: "\u5728\u6269\u5c55\u8bbe\u7f6e\u4e2d\u5f00\u542f\u5feb\u6377\u6309\u94ae\u540e\uff0c\u9009\u4e2d\u7f51\u9875\u6587\u672c\u65f6\u4f1a\u81ea\u52a8\u663e\u793a\u4e00\u4e2a\u4fbf\u6377\u7684 AI \u6309\u94ae\u3002\u70b9\u51fb\u8be5\u6309\u94ae\u5373\u53ef\u5feb\u901f\u547c\u51fa\u4f1a\u8bdd\u7a97\u53e3\uff0c\u8ba9\u60a8\u7684\u64cd\u4f5c\u66f4\u52a0\u6d41\u7545\u3002",
        shortcutUsage: "\u5feb\u6377\u952e\u4f7f\u7528",
        shortcutUsageDesc: "\u65e0\u8bba\u662f\u5426\u9009\u4e2d\u6587\u672c\uff0c\u90fd\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u81ea\u5b9a\u4e49\u5feb\u6377\u952e\u547c\u51fa\u5bf9\u8bdd\u7a97\u53e3\u3002",
        features: "\u529f\u80fd\u7279\u70b9",
        smartChat: "\u667a\u80fd\u5bf9\u8bdd",
        smartChat1: "\u2022 \u652f\u6301\u591a\u8f6e\u5bf9\u8bdd\uff0c\u8bb0\u4f4f\u4e0a\u4e0b\u6587",
        smartChat2: "\u2022 \u5b9e\u65f6\u6d41\u5f0f\u54cd\u5e94\uff0c\u6253\u5b57\u673a\u6548\u679c",
        smartChat3: "\u2022 \u652f\u6301\u91cd\u65b0\u751f\u6210\u56de\u7b54",
        uiInteraction: "\u754c\u9762\u4ea4\u4e92",
        uiInteraction1: "\u2022 \u53ef\u62d6\u62fd\u8c03\u6574\u7a97\u53e3\u4f4d\u7f6e\u548c\u5927\u5c0f",
        uiInteraction2: "\u2022 \u652f\u6301 Markdown \u683c\u5f0f\u5316\u663e\u793a",
        uiInteraction3: "\u2022 \u652f\u6301 LaTeX \u6570\u5b66\u516c\u5f0f\u6e32\u67d3",
        uiInteraction4: "\u2022 \u4ee3\u7801\u5757\u4e00\u952e\u590d\u5236",
        uiInteraction5: "\u2022 \u652f\u6301\u4ee3\u7801\u9ad8\u4eae",
        personalization: "\u4e2a\u6027\u5316\u8bbe\u7f6e",
        personalization1: "\u2022 \u81ea\u5b9a\u4e49AI\u56de\u590d\u8bed\u8a00\u504f\u597d",
        personalization2: "\u2022 \u6df1\u8272\u6a21\u5f0f\u81ea\u52a8\u9002\u914d",
        personalization3: "\u2022 \u53ef\u914d\u7f6e\u5feb\u6377\u952e",
        tips: "\u4f7f\u7528\u6280\u5de7",
        tip1: "\u{1f4a1} \u53ef\u81ea\u5b9a\u4e49\u5feb\u6377\u952e\u4ee5\u66f4\u5feb\u5730\u6253\u5f00\u5bf9\u8bdd\u7a97\u53e3",
        tip2: "\u{1f4a1} \u70b9\u51fb\u4ee3\u7801\u5757\u53f3\u4e0a\u89d2\u7684\u590d\u5236\u6309\u94ae\uff0c\u53ef\u4ee5\u5feb\u901f\u590d\u5236\u4ee3\u7801\u7247\u6bb5",
        tip3: "\u{1f4a1} \u5982\u679c\u5bf9 AI \u7684\u56de\u7b54\u4e0d\u6ee1\u610f\uff0c\u53ef\u4ee5\u70b9\u51fb\u91cd\u65b0\u751f\u6210\u6309\u94ae\u83b7\u53d6\u65b0\u7684\u7b54\u6848",
        feedback: "\u53cd\u9988\u4e0e\u652f\u6301",
        feedbackDesc: "\u5982\u679c\u60a8\u559c\u6b22 DeepSeek AI \u6269\u5c55\uff0c\u6b22\u8fce\u5728 Chrome \u7f51\u4e0a\u5e94\u7528\u5546\u5e97\u8bc4\u5206\u548c\u8bc4\u8bba\uff0c\u671f\u5f85\u60a8\u7684\u53cd\u9988\uff01",
        chromeFeedback: "\u524d\u5f80 Chrome \u5546\u5e97",
        chromeFeedbackDesc: "\u4e3a DeepSeek AI \u8bc4\u5206\u548c\u8bc4\u8bba",
        privacy: "\u9690\u79c1\u8bf4\u660e",
        privacyDesc: "\u91cd\u89c6\u60a8\u7684\u9690\u79c1\u3002DeepSeek AI \u6269\u5c55\u53ea\u4f1a\u5728\u5fc5\u8981\u65f6\u53d1\u9001\u60a8\u9009\u4e2d\u7684\u6587\u672c\u5230 API\uff0c\u4e0d\u4f1a\u6536\u96c6\u6216\u5b58\u50a8\u4efb\u4f55\u5176\u4ed6\u4e2a\u4eba\u4fe1\u606f\u3002\u60a8\u7684 API \u5bc6\u94a5\u4ec5\u4fdd\u5b58\u5728\u672c\u5730\u6d4f\u89c8\u5668\u4e2d\u3002"
    },
    en: {
        title: "DeepSeek AI User Guide",
        subtitle: "Enhance your web browsing experience with AI assistance",
        quickStart: "Quick Start",
        chromeInstall: "Install from Chrome Web Store",
        chromeDesc: "Install the extension from Chrome Web Store",
        edgeInstall: "Install from Edge Add-ons",
        edgeDesc: "Install the extension from Edge Add-ons",
        deepseekWebsite: "DeepSeek Website",
        deepseekDesc: "Visit the official DeepSeek AI website",
        apiKey: "Get API Key",
        apiDesc: "Obtain your API key on the DeepSeek platform",
        shortcuts: "Shortcut Settings",
        shortcutsDesc: "Customize extension shortcuts",
        github: "GitHub Repository",
        githubDesc: "View source code and submit suggestions",
        installationSteps: ["Install the DeepSeek AI extension in your browser", "Click the extension icon in the toolbar", "Enter your DeepSeek API key", "Select your preferred response language", "Enable the Quick Button feature", "Set your preferred shortcut keys", "Select text on the webpage to start a conversation with AI!"],
        usage: "Usage",
        quickButton: "Quick Button Usage",
        quickButtonDesc: "When the Quick Button is enabled in extension settings, an AI button will automatically appear when you select text on a webpage. Click this button to quickly open the chat window for a smoother experience.",
        shortcutUsage: "Shortcut Usage",
        shortcutUsageDesc: "Whether or not text is selected, you can directly use custom shortcuts to bring up the dialog window.",
        features: "Features",
        smartChat: "Smart Chat",
        smartChat1: "\u2022 Supports multi-turn conversations with context memory",
        smartChat2: "\u2022 Real-time streaming responses with typewriter effect",
        smartChat3: "\u2022 Supports regenerating responses",
        uiInteraction: "UI Interaction",
        uiInteraction1: "\u2022 Draggable and resizable window",
        uiInteraction2: "\u2022 Supports Markdown formatting",
        uiInteraction3: "\u2022 Supports LaTeX math rendering",
        uiInteraction4: "\u2022 One-click code block copying",
        uiInteraction5: "\u2022 Supports code highlighting",
        personalization: "Personalization",
        personalization1: "\u2022 Customize AI response language preference.",
        personalization2: "\u2022 Automatic dark mode adaptation",
        personalization3: "\u2022 Configurable shortcuts",
        tips: "Tips",
        tip1: "\u{1f4a1} Customizable shortcuts for faster opening of the chat window.",
        tip2: "\u{1f4a1} Click the copy button on the code block to quickly copy the code snippet.",
        tip3: "\u{1f4a1} If you're not satisfied with the AI's response, click the regenerate button to get a new answer.",
        feedback: "Feedback & Support",
        feedbackDesc: "If you like the DeepSeek AI extension, please rate and review it on the Chrome Web Store. We look forward to your feedback!",
        chromeFeedback: "Visit Chrome Web Store",
        chromeFeedbackDesc: "Rate and review DeepSeek AI",
        privacy: "Privacy Policy",
        privacyDesc: "We value your privacy. The DeepSeek AI extension only sends selected text to the API when necessary and does not collect or store any other personal information. Your API key is stored locally in your browser."
    }
};
let currentLang = "en";
const toggleLanguage = () => {
        console.log("Current language:", currentLang), currentLang = "zh" === currentLang ? "en" : "zh", console.log("Switching to:", currentLang);
        if (translations[currentLang]) try {
            updateContent(), console.log("Language switch completed")
        } catch (e) {
            console.error("Error updating content:", e)
        } else console.error("No translations found for", currentLang)
    },
    updateContent = () => {
        const e = translations[currentLang];
        document.getElementById("title").textContent = e.title, document.getElementById("subtitle").textContent = e.subtitle, document.getElementById("quick-start").textContent = e.quickStart, document.getElementById("chrome-install").textContent = e.chromeInstall, document.getElementById("chrome-desc").textContent = e.chromeDesc, document.getElementById("edge-install").textContent = e.edgeInstall, document.getElementById("edge-desc").textContent = e.edgeDesc, document.getElementById("deepseek-website").textContent = e.deepseekWebsite, document.getElementById("deepseek-desc").textContent = e.deepseekDesc, document.getElementById("api-key").textContent = e.apiKey, document.getElementById("api-desc").textContent = e.apiDesc, document.getElementById("shortcuts").textContent = e.shortcuts, document.getElementById("shortcuts-desc").textContent = e.shortcutsDesc, document.getElementById("github").textContent = e.github, document.getElementById("github-desc").textContent = e.githubDesc;
        document.querySelectorAll("#installation-steps li").forEach(((t, n) => {
            t.textContent = e.installationSteps[n]
        })), document.getElementById("usage").textContent = e.usage, document.getElementById("quick-button").textContent = e.quickButton, document.getElementById("quick-button-desc").textContent = e.quickButtonDesc, document.getElementById("shortcut-usage").textContent = e.shortcutUsage, document.getElementById("shortcut-usage-desc").textContent = e.shortcutUsageDesc, document.getElementById("features").textContent = e.features, document.getElementById("smart-chat").textContent = e.smartChat, document.getElementById("smart-chat-1").textContent = e.smartChat1, document.getElementById("smart-chat-2").textContent = e.smartChat2, document.getElementById("smart-chat-3").textContent = e.smartChat3, document.getElementById("ui-interaction").textContent = e.uiInteraction, document.getElementById("ui-interaction-1").textContent = e.uiInteraction1, document.getElementById("ui-interaction-2").textContent = e.uiInteraction2, document.getElementById("ui-interaction-3").textContent = e.uiInteraction3, document.getElementById("ui-interaction-4").textContent = e.uiInteraction4, document.getElementById("ui-interaction-5").textContent = e.uiInteraction5, document.getElementById("personalization").textContent = e.personalization, document.getElementById("personalization-1").textContent = e.personalization1, document.getElementById("personalization-2").textContent = e.personalization2, document.getElementById("personalization-3").textContent = e.personalization3, document.getElementById("tips").textContent = e.tips, document.getElementById("tip-1").textContent = e.tip1, document.getElementById("tip-2").textContent = e.tip2, document.getElementById("tip-3").textContent = e.tip3, document.getElementById("feedback").textContent = e.feedback, document.getElementById("feedback-desc").textContent = e.feedbackDesc, document.getElementById("chrome-feedback").textContent = e.chromeFeedback, document.getElementById("chrome-feedback-desc").textContent = e.chromeFeedbackDesc, document.getElementById("privacy").textContent = e.privacy, document.getElementById("privacy-desc").textContent = e.privacyDesc
    };
document.addEventListener("DOMContentLoaded", (() => {
    const e = document.getElementById("language-toggle");
    e ? (e.addEventListener("click", (e => {
        e.preventDefault(), console.log("Language toggle button clicked"), toggleLanguage()
    })), console.log("Language toggle button listener attached")) : console.error("Language toggle button not found")
})), document.getElementById("shortcuts-link").addEventListener("click", (function(e) {
    e.preventDefault(), chrome.runtime.openOptionsPage(), chrome.tabs.create({
        url: "chrome://extensions/shortcuts"
    })
}));